package com.ah.shanxi_demo.param.result;


import com.ah.shanxi_demo.common.enums.PolicyCommonEnum;
import com.ah.shanxi_demo.common.enums.PolicyGuidTypeEnum;
import com.ah.shanxi_demo.entity.SxPolicy;
import org.apache.commons.lang3.StringUtils;

import static com.ah.shanxi_demo.sync.utils.DateUtilCustom.df4;
import static com.ah.shanxi_demo.sync.utils.DateUtilCustom.format;

/**
 * @author zt 2020/8/15
 */
public class PolicyRO extends SxPolicy {

    private String logTypeName;

    private String policyTypeName;

    private String policyStatusName;

    private String generateTime;

    private String guidTypeName;

    private String policyReplaceStatus;


    public String getPolicyReplaceStatus() {

        if (null==getPolicyStatus()){
            return "";
        }

        return getPolicyStatus().toString();
    }

    public String getGuidTypeName() {
        if (null==getGuidType()) {
            return "";
        }
        String value = PolicyGuidTypeEnum.convert(getGuidType().toString()).getValue();
        return value;
    }

    public String getGenerateTime() {
        return format(getGmtCreate(), df4);
    }

    public String getPolicyStatusName() {

        if (null==getPolicyStatus()) {
            return "";
        }
        return PolicyCommonEnum.convert(getPolicyStatus().toString()).getValue();
    }

    public String getLogTypeName() {
        if (StringUtils.isBlank(getLogType())) {
            return "";
        }
        return PolicyCommonEnum.convert(getLogType()).getValue();
    }

    public String getPolicyTypeName() {
        if (StringUtils.isBlank(getPolicyType())) {
            return "";
        }
        return PolicyCommonEnum.convert(getPolicyType()).getValue();
    }

}
